
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>YUI Library Examples: StyleSheet: Adjusting a page theme on the fly</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    	<link rel="stylesheet" type="text/css" href="../../assets/yui.css" >

<style>
    /*Supplemental CSS for the YUI distribution*/
    #custom-doc { width: 95%; min-width: 950px; }
    #pagetitle {background-image: url(../../assets/bg_hd.gif);}
/*    #pagetitle h1 {background-image: url(../../assets/title_h_bg.gif);}*/
</style>

<link rel="stylesheet" type="text/css" href="../../assets/dpSyntaxHighlighter.css">

<!--there is no custom header content for this example-->

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>

</head>
<body id="yahoo-com" class="yui3-skin-sam  yui-skin-sam">
<div id="custom-doc" class="yui-t2">
<div id="hd">
	<div id="ygunav">
		<p>
            <em>
                <a href="http://developer.yahoo.com/yui/3/">YUI 3.x Home</a> <i> - </i>	
            </em>
		</p>
		<form action="http://search.yahoo.com/search" id="sitesearchform">
            <input name="vs" type="hidden" value="developer.yahoo.com">
            <input name="vs" type="hidden" value="yuiblog.com">
		    <div id="sitesearch">
		    	<label for="searchinput">Site Search (YDN &amp; YUIBlog): </label>
			    <input type="text" id="searchinput" name="p">
			    <input type="submit" value="Search" id="searchsubmit" class="ygbt">
		    </div>
		</form>
    </div>
	<div id="ygma"><a href="../../"><img src="../../assets/logo.gif"  border="0" width="200" height="93"></a></div>
	<div id="pagetitle"><h1>YUI Library Examples: StyleSheet: Adjusting a page theme on the fly</h1></div>
</div>
<div id="bd">


	<div id="yui-main">
		<div class="yui-b">
		  <div class="yui-ge">
			  <div class="yui-u first example" id="main">

	<h2>StyleSheet: Adjusting a page theme on the fly</h2>

	<div id="example" class="promo">
	<div class="example-intro">
	<p>In this example, we'll use a snapshot of the <a href="http://www.w3.org/TR/html401/present/styles.html">W3C HTML 4.01 specification for Style Sheets</a> and add a custom dynamic StyleSheet to apply some color and font size changes.</p>

<p>A Progressive enhancement strategy is used to extract a static form on the page into a draggable Overlay.  Additionally, one of the form inputs is replaced with a Slider.  Enter any valid CSS color value into the other inputs (e.g. <code>#123456</code>, <code>#135</code>, <code>rgb(0,0,0)</code>, or <code>red</code>).</p>
	</div>	

	<div class="module example-container  newWindow">
			<div id="example-canvas" class="bd">

		<p class="newWindowButton yui-skin-sam">
        <span id="newWindowLink">
            <span class="first-child">
                <a href="stylesheet_theme_source.html" target="_blank">View example in new window.</a>
            </span>
        </span>	
    </p>
	
		
		</div>
	</div>			
	</div>
		
	<h3 class="first">Full code listing</h3>
<h4 id="markup">Markup</h4>
<p>The markup as stated above is a local snapshot of the HTML 4.01 spec, but with the following markup added to the end of the <code>&lt;body&gt;</code> to show a progressive enhancement model.</p>

<div id="syntax-5b9f0684401ad4653c0f18dff94e14e1" class="yui-syntax-highlight yui-syntax-highlight-linenumbers"><div class="numbers"><pre class="html4strict" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="sc-1">&lt;!-- The original body content is above --&gt;</span></div></li><li class="li1"><div class="de1"><span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;form_container&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="kw2">form</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;yui3-widget-bd&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;theme_form&quot;</span> <span class="kw3">action</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span> <span class="kw3">method</span><span class="sy0">=</span><span class="st0">&quot;get&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">        <span class="sc2">&lt;<span class="kw2">fieldset</span>&gt;</span></div></li><li class="li2"><div class="de2">            <span class="sc2">&lt;<span class="kw2">h3</span>&gt;</span>Update Theme<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">h3</span>&gt;</span></div></li><li class="li1"><div class="de1">            <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;font_size&quot;</span>&gt;</span>Font size:<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span></div></li><li class="li1"><div class="de1">            <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;3&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;font_size&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;16px&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">            <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;heading_color&quot;</span>&gt;</span>Heading color:<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span></div></li><li class="li2"><div class="de2">            <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;12&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;heading_color&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;#005A9C&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">            <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;link_hover&quot;</span>&gt;</span>Link hover backgound:<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span></div></li><li class="li1"><div class="de1">            <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;12&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;link_hover&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;#ffa&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">        <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">fieldset</span>&gt;</span></div></li><li class="li2"><div class="de2">        <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;submit&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">form</span>&gt;</span></div></li><li class="li1"><div class="de1"><span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="html4strict" style="font-family:monospace;"><span class="sc-1">&lt;!-- The original body content is above --&gt;</span>
<span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;form_container&quot;</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">form</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;yui3-widget-bd&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;theme_form&quot;</span> <span class="kw3">action</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span> <span class="kw3">method</span><span class="sy0">=</span><span class="st0">&quot;get&quot;</span>&gt;</span>
        <span class="sc2">&lt;<span class="kw2">fieldset</span>&gt;</span>
            <span class="sc2">&lt;<span class="kw2">h3</span>&gt;</span>Update Theme<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">h3</span>&gt;</span>
            <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;font_size&quot;</span>&gt;</span>Font size:<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span>
            <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;3&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;font_size&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;16px&quot;</span>&gt;</span>
&nbsp;
            <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;heading_color&quot;</span>&gt;</span>Heading color:<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span>
            <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;12&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;heading_color&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;#005A9C&quot;</span>&gt;</span>
&nbsp;
            <span class="sc2">&lt;<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">&quot;link_hover&quot;</span>&gt;</span>Link hover backgound:<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">label</span>&gt;</span>
            <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;12&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;link_hover&quot;</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">&quot;#ffa&quot;</span>&gt;</span>
        <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">fieldset</span>&gt;</span>
        <span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;submit&quot;</span>&gt;</span>
    <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">form</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></pre></div><textarea id="syntax-5b9f0684401ad4653c0f18dff94e14e1-plain"><!-- The original body content is above -->
<div id="form_container">
    <form class="yui3-widget-bd" id="theme_form" action="#" method="get">
        <fieldset>
            <h3>Update Theme</h3>
            <label for="font_size">Font size:</label>
            <input type="text" size="3" id="font_size" value="16px">

            <label for="heading_color">Heading color:</label>
            <input type="text" size="12" id="heading_color" value="#005A9C">

            <label for="link_hover">Link hover backgound:</label>
            <input type="text" size="12" id="link_hover" value="#ffa">
        </fieldset>
        <input type="submit">
    </form>
</div></textarea></div>
<h4>JavaScript</h4>

<div id="syntax-fa693752c3370372e7e30ecbe55ddc28" class="yui-syntax-highlight yui-syntax-highlight-linenumbers"><div class="numbers"><pre class="javascript" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="co1">// Create a new YUI instance, requiring stylesheet, overlay, slider, and the</span></div></li><li class="li1"><div class="de1"><span class="co1">// dd-plugin to make the overlay draggable</span></div></li><li class="li1"><div class="de1">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">&quot;stylesheet&quot;</span><span class="sy0">,</span> <span class="st0">&quot;overlay&quot;</span><span class="sy0">,</span> <span class="st0">&quot;slider&quot;</span><span class="sy0">,</span> <span class="st0">&quot;dd-plugin&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2">    <span class="kw2">var</span> myStyleSheet <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">StyleSheet</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        overlayContent <span class="sy0">=</span> Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">'#form_container'</span><span class="br0">&#41;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        overlay<span class="sy0">,</span></div></li><li class="li1"><div class="de1">        slider<span class="sy0">,</span></div></li><li class="li1"><div class="de1">        slider_container<span class="sy0">,</span></div></li><li class="li2"><div class="de2">        fontSizeInput<span class="sy0">,</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">// Create the Overlay, using the form container as the contentBox.</span></div></li><li class="li1"><div class="de1">    <span class="co1">// The form is assigned a class yui-widget-bd that will be automatically</span></div></li><li class="li1"><div class="de1">    <span class="co1">// discovered by Overlay to populate the Overlay's body section.</span></div></li><li class="li2"><div class="de2">    <span class="co1">// The overlay is positioned in the top right corner, but made draggable</span></div></li><li class="li1"><div class="de1">    <span class="co1">// using Y.Plugin.Drag, provided by the dd-plugin module.</span></div></li><li class="li1"><div class="de1">    overlay <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">Overlay</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        srcNode<span class="sy0">:</span> overlayContent<span class="sy0">,</span></div></li><li class="li1"><div class="de1">        width<span class="sy0">:</span> <span class="st0">'225px'</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">        align<span class="sy0">:</span> <span class="br0">&#123;</span> points<span class="sy0">:</span> <span class="br0">&#91;</span> Y.<span class="me1">WidgetPositionAlign</span>.<span class="me1">TR</span><span class="sy0">,</span> Y.<span class="me1">WidgetPositionAlign</span>.<span class="me1">TR</span> <span class="br0">&#93;</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        plugins<span class="sy0">:</span> <span class="br0">&#91;</span> Y.<span class="me1">Plugin</span>.<span class="me1">Drag</span> <span class="br0">&#93;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">render</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">// Slider needs a parent element to have the sam skin class for UI skinning</span></div></li><li class="li2"><div class="de2">    overlayContent.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">'yui3-skin-sam'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">// Progressively enhance the font-size input with a Slider</span></div></li><li class="li1"><div class="de1">    fontSizeInput <span class="sy0">=</span> Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">'#font_size'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    fontSizeInput.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'type'</span><span class="sy0">,</span><span class="st0">'hidden'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    fontSizeInput.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'parentNode'</span><span class="br0">&#41;</span>.<span class="me1">insertBefore</span><span class="br0">&#40;</span></div></li><li class="li1"><div class="de1">        Y.<span class="me1">Node</span>.<span class="me1">create</span><span class="br0">&#40;</span><span class="st0">'6 &lt;span&gt;&lt;/span&gt; 36'</span><span class="br0">&#41;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        fontSizeInput<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    slider_container <span class="sy0">=</span> fontSizeInput.<span class="me1">previous</span><span class="br0">&#40;</span> <span class="st0">&quot;span&quot;</span> <span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">// Create a Slider to contain font size between 6px and 36px, using the</span></div></li><li class="li1"><div class="de1">    <span class="co1">// page's current font size as the initial value.</span></div></li><li class="li1"><div class="de1">    <span class="co1">// Set up an event subscriber during construction to update the replaced</span></div></li><li class="li1"><div class="de1">    <span class="co1">// input field's value and apply the change to the StyleSheet</span></div></li><li class="li2"><div class="de2">    slider <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">Slider</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        length<span class="sy0">:</span> <span class="st0">'100px'</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        min<span class="sy0">:</span> <span class="nu0">6</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        max<span class="sy0">:</span> <span class="nu0">36</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        value<span class="sy0">:</span> parseInt<span class="br0">&#40;</span>Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">'body'</span><span class="br0">&#41;</span>.<span class="me1">getStyle</span><span class="br0">&#40;</span><span class="st0">'fontSize'</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">||</span> <span class="nu0">13</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">        after<span class="sy0">:</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            valueChange<span class="sy0">:</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">                <span class="kw2">var</span> size <span class="sy0">=</span> e.<span class="me1">newVal</span> <span class="sy0">+</span> <span class="st0">'px'</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">                <span class="kw1">this</span>.<span class="me1">thumb</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'title'</span><span class="sy0">,</span> size<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">                fontSizeInput.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'value'</span><span class="sy0">,</span> size<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">                myStyleSheet.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'body'</span><span class="sy0">,</span> <span class="br0">&#123;</span> fontSize<span class="sy0">:</span> size <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">            <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li><li class="li2"><div class="de2">    <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">render</span><span class="br0">&#40;</span> slider_container <span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">// The color inputs are assigned keyup listeners that will update the</span></div></li><li class="li1"><div class="de1">    <span class="co1">// StyleSheet if the current input value is a valid CSS color value</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2">    <span class="co1">// The heading input affects all h1s, h2, and h3s</span></div></li><li class="li1"><div class="de1">    Y.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'keyup'</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> color <span class="sy0">=</span> <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'value'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">        <span class="kw1">if</span> <span class="br0">&#40;</span>isValidColor<span class="br0">&#40;</span>color<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li2"><div class="de2">            myStyleSheet.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'h1, h2, h3'</span><span class="sy0">,</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> color <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">'#heading_color'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">// The link hover affects the background color of links when they are</span></div></li><li class="li2"><div class="de2">    <span class="co1">// hovered.  There is no way other than via stylesheet modification to</span></div></li><li class="li1"><div class="de1">    <span class="co1">// change pseudo-class styles.</span></div></li><li class="li1"><div class="de1">    Y.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'keyup'</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> color <span class="sy0">=</span> <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'value'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2">        <span class="kw1">if</span> <span class="br0">&#40;</span>isValidColor<span class="br0">&#40;</span>color<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            myStyleSheet.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'a:hover'</span><span class="sy0">,</span> <span class="br0">&#123;</span> backgroundColor<span class="sy0">:</span> color <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">'#link_hover'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2">    <span class="co1">// Progressive form enhancement complete, now prevent the form from</span></div></li><li class="li1"><div class="de1">    <span class="co1">// submitting normally.</span></div></li><li class="li1"><div class="de1">    Y.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'submit'</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        e.<span class="me1">halt</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">'#theme_form'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="co1">// A rudimentary validator to make sure we're not trying to set</span></div></li><li class="li1"><div class="de1">	<span class="co1">// invalid color values in StyleSheet.</span></div></li><li class="li1"><div class="de1">	<span class="kw2">function</span> isValidColor<span class="br0">&#40;</span>v<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw1">return</span> <span class="co2">/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i</span>.<span class="me1">test</span><span class="br0">&#40;</span>v<span class="br0">&#41;</span> <span class="sy0">||</span></div></li><li class="li2"><div class="de2">               <span class="co2">/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/</span>.<span class="me1">test</span><span class="br0">&#40;</span>v<span class="br0">&#41;</span> <span class="sy0">||</span></div></li><li class="li1"><div class="de1">               <span class="co2">/^[a-z]{3,}$/i</span>.<span class="me1">test</span><span class="br0">&#40;</span>v<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="javascript" style="font-family:monospace;"><span class="co1">// Create a new YUI instance, requiring stylesheet, overlay, slider, and the</span>
<span class="co1">// dd-plugin to make the overlay draggable</span>
YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">&quot;stylesheet&quot;</span><span class="sy0">,</span> <span class="st0">&quot;overlay&quot;</span><span class="sy0">,</span> <span class="st0">&quot;slider&quot;</span><span class="sy0">,</span> <span class="st0">&quot;dd-plugin&quot;</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp;
    <span class="kw2">var</span> myStyleSheet <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">StyleSheet</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">,</span>
        overlayContent <span class="sy0">=</span> Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">'#form_container'</span><span class="br0">&#41;</span><span class="sy0">,</span>
        overlay<span class="sy0">,</span>
        slider<span class="sy0">,</span>
        slider_container<span class="sy0">,</span>
        fontSizeInput<span class="sy0">,</span>
&nbsp;
    <span class="co1">// Create the Overlay, using the form container as the contentBox.</span>
    <span class="co1">// The form is assigned a class yui-widget-bd that will be automatically</span>
    <span class="co1">// discovered by Overlay to populate the Overlay's body section.</span>
    <span class="co1">// The overlay is positioned in the top right corner, but made draggable</span>
    <span class="co1">// using Y.Plugin.Drag, provided by the dd-plugin module.</span>
    overlay <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">Overlay</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
        srcNode<span class="sy0">:</span> overlayContent<span class="sy0">,</span>
        width<span class="sy0">:</span> <span class="st0">'225px'</span><span class="sy0">,</span>
        align<span class="sy0">:</span> <span class="br0">&#123;</span> points<span class="sy0">:</span> <span class="br0">&#91;</span> Y.<span class="me1">WidgetPositionAlign</span>.<span class="me1">TR</span><span class="sy0">,</span> Y.<span class="me1">WidgetPositionAlign</span>.<span class="me1">TR</span> <span class="br0">&#93;</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        plugins<span class="sy0">:</span> <span class="br0">&#91;</span> Y.<span class="me1">Plugin</span>.<span class="me1">Drag</span> <span class="br0">&#93;</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">render</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">// Slider needs a parent element to have the sam skin class for UI skinning</span>
    overlayContent.<span class="me1">addClass</span><span class="br0">&#40;</span><span class="st0">'yui3-skin-sam'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">// Progressively enhance the font-size input with a Slider</span>
    fontSizeInput <span class="sy0">=</span> Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">'#font_size'</span><span class="br0">&#41;</span><span class="sy0">;</span>
    fontSizeInput.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'type'</span><span class="sy0">,</span><span class="st0">'hidden'</span><span class="br0">&#41;</span><span class="sy0">;</span>
    fontSizeInput.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'parentNode'</span><span class="br0">&#41;</span>.<span class="me1">insertBefore</span><span class="br0">&#40;</span>
        Y.<span class="me1">Node</span>.<span class="me1">create</span><span class="br0">&#40;</span><span class="st0">'6 &lt;span&gt;&lt;/span&gt; 36'</span><span class="br0">&#41;</span><span class="sy0">,</span>
        fontSizeInput<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    slider_container <span class="sy0">=</span> fontSizeInput.<span class="me1">previous</span><span class="br0">&#40;</span> <span class="st0">&quot;span&quot;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">// Create a Slider to contain font size between 6px and 36px, using the</span>
    <span class="co1">// page's current font size as the initial value.</span>
    <span class="co1">// Set up an event subscriber during construction to update the replaced</span>
    <span class="co1">// input field's value and apply the change to the StyleSheet</span>
    slider <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">Slider</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
        length<span class="sy0">:</span> <span class="st0">'100px'</span><span class="sy0">,</span>
        min<span class="sy0">:</span> <span class="nu0">6</span><span class="sy0">,</span>
        max<span class="sy0">:</span> <span class="nu0">36</span><span class="sy0">,</span>
        value<span class="sy0">:</span> parseInt<span class="br0">&#40;</span>Y.<span class="me1">one</span><span class="br0">&#40;</span><span class="st0">'body'</span><span class="br0">&#41;</span>.<span class="me1">getStyle</span><span class="br0">&#40;</span><span class="st0">'fontSize'</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">||</span> <span class="nu0">13</span><span class="sy0">,</span>
        after<span class="sy0">:</span> <span class="br0">&#123;</span>
            valueChange<span class="sy0">:</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
                <span class="kw2">var</span> size <span class="sy0">=</span> e.<span class="me1">newVal</span> <span class="sy0">+</span> <span class="st0">'px'</span><span class="sy0">;</span>
&nbsp;
                <span class="kw1">this</span>.<span class="me1">thumb</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'title'</span><span class="sy0">,</span> size<span class="br0">&#41;</span><span class="sy0">;</span>
                fontSizeInput.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'value'</span><span class="sy0">,</span> size<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
                myStyleSheet.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'body'</span><span class="sy0">,</span> <span class="br0">&#123;</span> fontSize<span class="sy0">:</span> size <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
            <span class="br0">&#125;</span>
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">render</span><span class="br0">&#40;</span> slider_container <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">// The color inputs are assigned keyup listeners that will update the</span>
    <span class="co1">// StyleSheet if the current input value is a valid CSS color value</span>
&nbsp;
    <span class="co1">// The heading input affects all h1s, h2, and h3s</span>
    Y.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'keyup'</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> color <span class="sy0">=</span> <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'value'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
        <span class="kw1">if</span> <span class="br0">&#40;</span>isValidColor<span class="br0">&#40;</span>color<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
            myStyleSheet.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'h1, h2, h3'</span><span class="sy0">,</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> color <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">'#heading_color'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">// The link hover affects the background color of links when they are</span>
    <span class="co1">// hovered.  There is no way other than via stylesheet modification to</span>
    <span class="co1">// change pseudo-class styles.</span>
    Y.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'keyup'</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> color <span class="sy0">=</span> <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'value'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
        <span class="kw1">if</span> <span class="br0">&#40;</span>isValidColor<span class="br0">&#40;</span>color<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
            myStyleSheet.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'a:hover'</span><span class="sy0">,</span> <span class="br0">&#123;</span> backgroundColor<span class="sy0">:</span> color <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">'#link_hover'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">// Progressive form enhancement complete, now prevent the form from</span>
    <span class="co1">// submitting normally.</span>
    Y.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'submit'</span><span class="sy0">,</span> <span class="kw2">function</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        e.<span class="me1">halt</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span><span class="sy0">,</span> <span class="st0">'#theme_form'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	<span class="co1">// A rudimentary validator to make sure we're not trying to set</span>
	<span class="co1">// invalid color values in StyleSheet.</span>
	<span class="kw2">function</span> isValidColor<span class="br0">&#40;</span>v<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw1">return</span> <span class="co2">/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i</span>.<span class="me1">test</span><span class="br0">&#40;</span>v<span class="br0">&#41;</span> <span class="sy0">||</span>
               <span class="co2">/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/</span>.<span class="me1">test</span><span class="br0">&#40;</span>v<span class="br0">&#41;</span> <span class="sy0">||</span>
               <span class="co2">/^[a-z]{3,}$/i</span>.<span class="me1">test</span><span class="br0">&#40;</span>v<span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div><textarea id="syntax-fa693752c3370372e7e30ecbe55ddc28-plain">// Create a new YUI instance, requiring stylesheet, overlay, slider, and the
// dd-plugin to make the overlay draggable
YUI().use("stylesheet", "overlay", "slider", "dd-plugin", function (Y) {

    var myStyleSheet = new Y.StyleSheet(),
        overlayContent = Y.one('#form_container'),
        overlay,
        slider,
        slider_container,
        fontSizeInput,

    // Create the Overlay, using the form container as the contentBox.
    // The form is assigned a class yui-widget-bd that will be automatically
    // discovered by Overlay to populate the Overlay's body section.
    // The overlay is positioned in the top right corner, but made draggable
    // using Y.Plugin.Drag, provided by the dd-plugin module.
    overlay = new Y.Overlay({
        srcNode: overlayContent,
        width: '225px',
        align: { points: [ Y.WidgetPositionAlign.TR, Y.WidgetPositionAlign.TR ] },
        plugins: [ Y.Plugin.Drag ]
    }).render();

    // Slider needs a parent element to have the sam skin class for UI skinning
    overlayContent.addClass('yui3-skin-sam');

    // Progressively enhance the font-size input with a Slider
    fontSizeInput = Y.one('#font_size');
    fontSizeInput.set('type','hidden');
    fontSizeInput.get('parentNode').insertBefore(
        Y.Node.create('6 <span></span> 36'),
        fontSizeInput);

    slider_container = fontSizeInput.previous( "span" );

    // Create a Slider to contain font size between 6px and 36px, using the
    // page's current font size as the initial value.
    // Set up an event subscriber during construction to update the replaced
    // input field's value and apply the change to the StyleSheet
    slider = new Y.Slider({
        length: '100px',
        min: 6,
        max: 36,
        value: parseInt(Y.one('body').getStyle('fontSize')) || 13,
        after: {
            valueChange: function (e) {
                var size = e.newVal + 'px';

                this.thumb.set('title', size);
                fontSizeInput.set('value', size);

                myStyleSheet.set('body', { fontSize: size });
            }
        }
    }).render( slider_container );

    // The color inputs are assigned keyup listeners that will update the
    // StyleSheet if the current input value is a valid CSS color value

    // The heading input affects all h1s, h2, and h3s
    Y.on('keyup', function (e) {
        var color = this.get('value');

        if (isValidColor(color)) {
            myStyleSheet.set('h1, h2, h3', { color: color });
        }
    }, '#heading_color');

    // The link hover affects the background color of links when they are
    // hovered.  There is no way other than via stylesheet modification to
    // change pseudo-class styles.
    Y.on('keyup', function (e) {
        var color = this.get('value');

        if (isValidColor(color)) {
            myStyleSheet.set('a:hover', { backgroundColor: color });
        }
    }, '#link_hover');
	
    // Progressive form enhancement complete, now prevent the form from
    // submitting normally.
    Y.on('submit', function (e) {
        e.halt();
    }, '#theme_form');

	// A rudimentary validator to make sure we're not trying to set
	// invalid color values in StyleSheet.
	function isValidColor(v) {
        return /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(v) ||
               /^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)$/.test(v) ||
               /^[a-z]{3,}$/i.test(v);
	}

});</textarea></div>
<h4>CSS</h4>
<p>This is the CSS added to the page to skin the Overlay and its content.</p>

<div id="syntax-e91076291ac8da83c50dcc68dfa83518" class="yui-syntax-highlight yui-syntax-highlight-linenumbers"><div class="numbers"><pre class="css" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="coMULTI">/* For supporting browsers, the overlay is rendered semi-transparent with</span></div></li><li class="li1"><div class="de1"><span class="coMULTI">&nbsp;* fancy rounded corners */</span></div></li><li class="li1"><div class="de1"><span class="re1">.yui3-overlay</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">background</span><span class="sy0">:</span> rgba<span class="br0">&#40;</span><span class="nu0">128</span><span class="sy0">,</span><span class="nu0">128</span><span class="sy0">,</span><span class="nu0">128</span><span class="sy0">,</span><span class="nu0">0.3</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">7px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">cursor</span><span class="sy0">:</span> move<span class="sy0">;</span></div></li><li class="li2"><div class="de2"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="re1">.yui3-overlay-content</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">background</span><span class="sy0">:</span> rgba<span class="br0">&#40;</span><span class="nu0">205</span><span class="sy0">,</span><span class="nu0">205</span><span class="sy0">,</span><span class="nu0">205</span><span class="sy0">,</span><span class="nu0">0.3</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">1px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span> </div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2"><span class="re1">.yui3-overlay</span> form <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#f2fbff</span> <span class="kw2">url</span><span class="br0">&#40;</span><span class="co2">gradient-promo.png</span><span class="br0">&#41;</span> <span class="kw2">repeat-x</span> <span class="kw2">scroll</span> <span class="nu0">0</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="kw2">solid</span> <span class="re0">#fff</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">13px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li2"><div class="de2">&nbsp;</div></li><li class="li1"><div class="de1"><span class="re1">.yui3-overlay</span> fieldset <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#bcd</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">20px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2"><span class="re1">.yui3-overlay</span> h3 <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="kw2">solid</span> <span class="re0">#fff</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#479</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">background</span><span class="sy0">:</span> <span class="kw2">transparent</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3"><span class="nu0">175</span>%</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="re1">.yui3-overlay</span> label <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">1.3em</span> <span class="nu0">0</span> <span class="re3">0.5ex</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#003</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li2"><div class="de2"><span class="re1">.yui3-overlay</span> p <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">2em</span> <span class="nu0">0</span> <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="coMULTI">/* override the move cursor for the Slider */</span></div></li><li class="li2"><div class="de2"><span class="re1">.yui3-overlay</span> <span class="re1">.yui3-slider</span><span class="re2">:hover </span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">cursor</span><span class="sy0">:</span> <span class="kw2">default</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="css" style="font-family:monospace;"><span class="coMULTI">/* For supporting browsers, the overlay is rendered semi-transparent with
 * fancy rounded corners */</span>
<span class="re1">.yui3-overlay</span> <span class="br0">&#123;</span>
    <span class="kw1">background</span><span class="sy0">:</span> rgba<span class="br0">&#40;</span><span class="nu0">128</span><span class="sy0">,</span><span class="nu0">128</span><span class="sy0">,</span><span class="nu0">128</span><span class="sy0">,</span><span class="nu0">0.3</span><span class="br0">&#41;</span><span class="sy0">;</span>
    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">7px</span><span class="sy0">;</span>
    <span class="kw1">cursor</span><span class="sy0">:</span> move<span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re1">.yui3-overlay-content</span> <span class="br0">&#123;</span>
    <span class="kw1">background</span><span class="sy0">:</span> rgba<span class="br0">&#40;</span><span class="nu0">205</span><span class="sy0">,</span><span class="nu0">205</span><span class="sy0">,</span><span class="nu0">205</span><span class="sy0">,</span><span class="nu0">0.3</span><span class="br0">&#41;</span><span class="sy0">;</span>
    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">1px</span><span class="sy0">;</span>
<span class="br0">&#125;</span> 
&nbsp;
<span class="re1">.yui3-overlay</span> form <span class="br0">&#123;</span>
    <span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#f2fbff</span> <span class="kw2">url</span><span class="br0">&#40;</span><span class="co2">gradient-promo.png</span><span class="br0">&#41;</span> <span class="kw2">repeat-x</span> <span class="kw2">scroll</span> <span class="nu0">0</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="kw2">solid</span> <span class="re0">#fff</span><span class="sy0">;</span>
    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">13px</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re1">.yui3-overlay</span> fieldset <span class="br0">&#123;</span>
    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#bcd</span><span class="sy0">;</span>
    -moz-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    -webkit-border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    border-radius<span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re1">.yui3-overlay</span> h3 <span class="br0">&#123;</span>
    <span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="kw2">solid</span> <span class="re0">#fff</span><span class="sy0">;</span>
    <span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#479</span><span class="sy0">;</span>
    <span class="kw1">background</span><span class="sy0">:</span> <span class="kw2">transparent</span><span class="sy0">;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
    <span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3"><span class="nu0">175</span>%</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re1">.yui3-overlay</span> label <span class="br0">&#123;</span>
    <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">1.3em</span> <span class="nu0">0</span> <span class="re3">0.5ex</span><span class="sy0">;</span>
    <span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span>
    <span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#003</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re1">.yui3-overlay</span> p <span class="br0">&#123;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">2em</span> <span class="nu0">0</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="coMULTI">/* override the move cursor for the Slider */</span>
<span class="re1">.yui3-overlay</span> <span class="re1">.yui3-slider</span><span class="re2">:hover </span><span class="br0">&#123;</span>
    <span class="kw1">cursor</span><span class="sy0">:</span> <span class="kw2">default</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div><textarea id="syntax-e91076291ac8da83c50dcc68dfa83518-plain">/* For supporting browsers, the overlay is rendered semi-transparent with
 * fancy rounded corners */
.yui3-overlay {
    background: rgba(128,128,128,0.3);
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    padding: 7px;
    cursor: move;
}

.yui3-overlay-content {
    background: rgba(205,205,205,0.3);
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    padding: 1px;
} 

.yui3-overlay form {
    background: #f2fbff url(gradient-promo.png) repeat-x scroll 0 0;
    border: 2px solid #fff;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    margin: 0;
    padding: 0;
    font-size: 13px;
}

.yui3-overlay fieldset {
    border: 1px solid #bcd;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    margin: 0;
    padding: 20px;
}

.yui3-overlay h3 {
    border-bottom: 2px solid #fff;
    color: #479;
    background: transparent;
    margin: 0;
    font-size: 175%;
}

.yui3-overlay label {
    display: block;
    margin: 1.3em 0 0.5ex;
    font-weight: bold;
    color: #003;
}

.yui3-overlay p {
    margin: 2em 0 0;
}

/* override the move cursor for the Slider */
.yui3-overlay .yui3-slider:hover {
    cursor: default;
}</textarea></div>				</div>
				<div class="yui-u sidebar">
					
				
					<div id="examples" class="mod box4">
                        <div class="hd">
						<h4>
    StyleSheet Examples:</h4>
                        </div>
						<div class="bd">
							<ul>
								<li class='selected'><a href='../stylesheet/stylesheet_theme.html'>Adjusting a page theme on the fly</a></li><li><a href='../dd/photo-browser.html'>Photo Browser (included with examples for Drag &amp; Drop)</a></li>							</ul>
						</div>
					</div>
					
					<div class="mod box4">
                        <div class="hd">
						<h4>More StyleSheet Resources:</h4>
                        </div>
                        <div class="bd">
						<ul>
							<!-- <li><a href="http://developer.yahoo.com/yui/stylesheet/">User's Guide</a> (external)</li> -->
<li><a href="../../api/module_stylesheet.html">API Documentation</a></li></ul>
                        </div>
					</div>
			  </div>
		</div>
		
		</div>
	</div>


<div class="yui-b toc3" id="tocWrapper">
<!-- TABLE OF CONTENTS -->
<div id="toc">
	
<ul>
<li class="sect first">YUI 3 Resources</li><li class="item"><a title="YUI 3 -- Yahoo! User Interface (YUI) Library" href="http://developer.yahoo.com/yui/3/">YUI 3 Web Site</a></li><li class="item"><a title="Examples of every YUI utility and control in action" href="../../examples/">YUI 3 Examples</a></li><li class="item"><a title="Instantly searchable API documentation for the entire YUI library." href="../../api/">YUI 3 API Docs</a></li><li class="item"><a title="YUI 3 Dependency Configurator -- configure your custom YUI implementation" href="http://developer.yahoo.com/yui/3/configurator/index.html">YUI 3 Dependency Configurator</a></li><li class="item"><a title="The YUI 3 Forum on YUILibrary.com" href="http://yuilibrary.com/forum/viewforum.php?f=15">YUI 3 Forums (external)</a></li><li class="item"><a title="Found a bug or a missing feature? Let us know on YUILibrary.com." href="http://developer.yahoo.com/yui/articles/reportingbugs/">Bug Reports/Feature Requests</a></li><li class="item"><a title="YUI is free and open, offered under a BSD license." href="http://developer.yahoo.com/yui/license.html">YUI License</a></li><li class="item"><a title="Download and fork the YUI project on GitHub" href="http://github.com/yui">YUI on Github</a></li><li class="item"><a title="The Yahoo! User Interface Blog" href="http://yuiblog.com">YUI Blog (external)</a></li><li class="sect">YUI 3 Core - Examples</li><li class="item"><a title="YUI Global Object - Functional Examples" href="../../examples/yui/index.html">YUI Global Object</a></li><li class="item"><a title="Event - Functional Examples" href="../../examples/event/index.html">Event</a></li><li class="item"><a title="Node - Functional Examples" href="../../examples/node/index.html">Node</a></li><li class="sect">YUI 3 Component Infrastructure - Examples</li><li class="item"><a title="Attribute - Functional Examples" href="../../examples/attribute/index.html">Attribute</a></li><li class="item"><a title="Plugin - Functional Examples" href="../../examples/plugin/index.html">Plugin</a></li><li class="item"><a title="Widget - Functional Examples" href="../../examples/widget/index.html">Widget</a></li><li class="sect">YUI 3 Utilities - Examples</li><li class="item"><a title="Animation - Functional Examples" href="../../examples/anim/index.html">Animation</a></li><li class="item"><a title="AsyncQueue - Functional Examples" href="../../examples/async-queue/index.html">AsyncQueue</a></li><li class="item"><a title="Browser History - Functional Examples" href="../../examples/history/index.html">Browser History</a></li><li class="item"><a title="Cache - Functional Examples" href="../../examples/cache/index.html">Cache</a></li><li class="item"><a title="Cookie - Functional Examples" href="../../examples/cookie/index.html">Cookie</a></li><li class="item"><a title="DataSchema - Functional Examples" href="../../examples/dataschema/index.html">DataSchema <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="DataSource - Functional Examples" href="../../examples/datasource/index.html">DataSource <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="DataType - Functional Examples" href="../../examples/datatype/index.html">DataType <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Drag &amp; Drop - Functional Examples" href="../../examples/dd/index.html">Drag &amp; Drop</a></li><li class="item"><a title="Get - Functional Examples" href="../../examples/get/index.html">Get</a></li><li class="item"><a title="ImageLoader - Functional Examples" href="../../examples/imageloader/index.html">ImageLoader</a></li><li class="item"><a title="Internationalization - Functional Examples" href="../../examples/intl/index.html">Internationalization <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="IO - Functional Examples" href="../../examples/io/index.html">IO</a></li><li class="item"><a title="JSON (JavaScript Object Notation) - Functional Examples" href="../../examples/json/index.html">JSON</a></li><li class="selected "><a title="Stylesheet - Functional Examples" href="../../examples/stylesheet/index.html">Stylesheet</a></li><li class="sect">YUI 3 Widgets - Examples</li><li class="item"><a title="Overlay - Functional Examples" href="../../examples/overlay/index.html">Overlay <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Slider - Functional Examples" href="../../examples/slider/index.html">Slider <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Tabview - Functional Examples" href="../../examples/tabview/index.html">Tabview <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="sect">YUI 3 Node Plugins - Examples</li><li class="item"><a title="FocusManager Node Plugin - Functional Examples" href="../../examples/node-focusmanager/index.html">FocusManager Node Plugin <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="MenuNav Node Plugin - Functional Examples" href="../../examples/node-menunav/index.html">MenuNav Node Plugin <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="sect">YUI 3 CSS - Examples</li><li class="item"><a title="YUI CSS Reset - Functional Examples" href="../../examples/cssreset/index.html">CSS Reset</a></li><li class="item"><a title="YUI Fonts - Functional Examples" href="../../examples/cssfonts/index.html">CSS Fonts</a></li><li class="item"><a title="YUI Base - Functional Examples" href="../../examples/cssbase/index.html">CSS Base</a></li><li class="sect">YUI 3 Developer Tools - Examples</li><li class="item"><a title="Console - Functional Examples" href="../../examples/console/index.html">Console <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Console Filters Plugin- Functional Examples" href="../../examples/console-filters/index.html">Plugin.ConsoleFilters <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Profiler - Functional Examples" href="../../examples/profiler/index.html">Profiler</a></li><li class="item"><a title="Test - Functional Examples" href="../../examples/test/index.html">Test</a></li><li class="sect">Other Useful YUI 3 Resources</li><li class="item"><a title="Answers to Frequently Asked Questions about the YUI Library" href="http://developer.yahoo.com/yui/articles/faq/">YUI FAQ (external)</a></li><li class="item"><a title="Yahoo!'s philosophy of Graded Browser Support" href="http://developer.yahoo.com/yui/articles/gbs/">Graded Browser Support (external)</a></li><li class="item"><a title="Videos and podcasts from the YUI Team and from the Yahoo! frontend engineering community." href="http://developer.yahoo.com/yui/theater/">YUI Theater (external)</a></li></ul>
</div>
</div>
	</div><!--closes bd-->

	<div id="ft">
        <p class="first">Copyright &copy; 2010 Yahoo! Inc. All rights reserved.</p>
        <p><a href="http://privacy.yahoo.com/privacy/us/devel/index.html">Privacy Policy</a> - 
            <a href="http://docs.yahoo.com/info/terms/">Terms of Service</a> - 
            <a href="http://docs.yahoo.com/info/copyright/copyright.html">Copyright Policy</a> - 
            <a href="http://careers.yahoo.com/">Job Openings</a></p>
	</div>
</div>
<script language="javascript"> 
var yuiConfig = {};
</script>
<script src="../../assets/syntax.js"></script>
<script src="../../assets/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code'); 
</script>
</body>
</html>
